package com.kasax.test.bc.ui.fragment

import android.view.View
import com.kasax.base.BasicBindingFragment
import com.kasax.hilog.Logger
import com.kasax.hilog.ViewHelper
import com.kasax.test.bc.R
import com.kasax.test.bc.databinding.FragmentHilogTestBinding
import com.kasax.test.bc.entry.User

class HiLogTestFragment : BasicBindingFragment<FragmentHilogTestBinding>() {
    override fun getLayoutId(): Int = R.layout.fragment_hilog_test

    override fun addListeners(view: View) {
        viewBinding.btnSimpleLogTest.setOnClickListener {
            Logger.log("Simple Log Test")
        }

        viewBinding.btnCrashTest.setOnClickListener {
            Logger.log(RuntimeException("Crash Test"))
        }

        viewBinding.btnJsonTest.setOnClickListener {
            Logger.log(User("kasax", 18, "hunan"))
        }
    }

    override fun onDestroyView() {
        super.onDestroyView()
        ViewHelper.release()
    }
}